/*
 * anima/x86_64/firmware.hh - x86-64-specific firmware interface.
 * Copyright (C) 2007  Mikhail Vorozhtsov
 * See the LICENSE section of the README file for details.
 */

/* $Id$ */

#ifndef HEADER_ANIMA_X86_64_FIRMWARE_HH
#define HEADER_ANIMA_X86_64_FIRMWARE_HH

#include HEADER (elbp,elbp.hh)

START_NAMESPACE2 (anima,x86_64)

class firmware
{
public:
  struct ioapic_t
  {
  public:
    u64_t addr;
    u32_t ints_base;

  public:
    static const void *next (const void *prev, ioapic_t &ioapic);
  };

protected:
  static u64_t lapic_base;
  static u64_t timer_freq;
  static u64_t timer_period;

protected:
  static bool init (const elbp::info_t *elbp_info);

public:
  INLINE
  static u64_t
  get_lapic_base ()
  {
    return lapic_base;
  }

  INLINE
  static u64_t
  get_timer_freq ()
  {
    return timer_freq;
  }

  INLINE
  static u64_t
  get_timer_period ()
  {
    return timer_period;
  }

  static u64_t read_timer ();
};

END_NAMESPACE2

#endif /* HEADER_ANIMA_X86_64_FIRMWARE_HH */

